package 简单.左叶子之和;

public class Solution1 {
    public int sumOfLeftLeaves(TreeNode root) {

        if(root == null||root.left == null) return 0;

        int sumofLeft = sumOfLeftLeaves(root.left);
        int sumofRight = sumOfLeftLeaves(root.right);
        return sumofLeft+sumofRight + (root.left!=null && root.left.left==null && root.left.right==null ? root.left.val : 0);
    }
}
